﻿using System.Web.Mvc;
using System.Web.Routing;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc.Routes;

namespace Nop.Web.CDN.Infrastructure
{
    public partial class RouteProvider : IRouteProvider
    {
        public void RegisterRoutes(RouteCollection routes)
        {
            //dynamic thumbs picture with specific width and height.
            routes.MapRoute(
                "DymamicPicture",
                "i/d/{property}/{name}",
                new { controller = "Picture", action = "DynamicPicture" },
                new { property = @"[A-Za-z0-9-_]+", name = @"[A-Za-z0-9\-_]+\.[a-zA-Z]{3,4}$" },
                new[] { "Nop.Web.CDN.Controllers" }
            );

            //dynamic thumbs picture with specific width and height.
            routes.MapRoute(
                "DymamicPictureWithoutSEOFilename",
                "i/d/{name}",
                new { controller = "Picture", action = "DymamicPictureWithoutSEOFilename" },
                new { name = @"[A-Za-z0-9\-_]+\.[a-zA-Z]{3,4}$" },
                new[] { "Nop.Web.CDN.Controllers" }
            );

            //robots.txt
            routes.MapRoute("robots.txt",
                            "robots.txt",
                            new { controller = "Common", action = "RobotsTextFile" },
                            new[] { "Nop.Web.CDN.Controllers" });
        }
        public int Priority
        {
            get
            {
                return 0;
            }
        }
    }
}
